// Ofri Keidar 302933981 group 05

/**
 * The class represents a flat (a.k.a "regular" apartment). 
 * The class inherits from class Apartment. The class is serializable so a building could be saved and restored from a file easily
 */

package model.apartment;

//import java.util.Map;

public class Flat extends Apartment {
	
	private static final long serialVersionUID = 1788278656953524692L; // set serial number
	
	// methods
	
	/**
	 * Constructor- creates a new flat according to given values
	 * @param floor- flat's floor
	 * @param roomNum- flat's room number
	 * @param size- flat's size
	 * @param wareHouse- flat's warehouse's size
	 * @param resName- flat's resident name
	 */
	public Flat(int floor, double roomNum, double size, double wareHouse ,String resName) {
		// use base class's constructor
		super(floor, roomNum, size, wareHouse, resName);
	}
	
	/**
	 * Constructor- creates a new flat according to given values. Used when no resident name is given 
	 * @param floor- flat's floor
	 * @param roomNum- flat's room number
	 * @param size- flat's size
	 * @param wareHouse- flat's warehouse's size
	 */
	public Flat(int floor, double roomNum, double size, double wareHouse) {
		// use base class's constructor
		super(floor, roomNum, size, wareHouse);
	}
	
	/**
	 * Returns flat's warehouse's size, using base class's extra unit getter 
	 * @return warehouse size
	 */
	public double getWarehouse() { return getExtraUnit(); }
	
	/**
	 * Sets warehouse size as given value
	 * @param newWarehouseSize- new size for warehouse
	 */
	public void setWarehosue(double newWarehouseSize) { setExtraUnit(newWarehouseSize); }

	/**
	 * Calculates flat's total area as sum of flat's size and warehouse 
	 */
	public double totalArea() {
		// sum size and warehouse's size and return result
		return getSize() + getWarehouse(); 
	}
	
	/**
	 * Returns flat's printing format (as a String object) using base class's toString()
	 */
	public String toString() {
		// use Apartment class's string format to create output
		return "Type: flat, " + super.toString();
	}
}